HTMLify
app.js
Views: 5 | Author: cody
const boxes = document.querySelectorAll(".article");
window.addEventListener("scroll", checkBoxes);
checkBoxes();
function checkBoxes() {
const triggerBottom = window.innerHeight / 2;
boxes.forEach((box) => {
const boxTop = box.getBoundingClientRect().top;
if (boxTop < triggerBottom) {
box.classList.add("show");
} else {
box.classList.remove("show");
}
});
}